<template>
    <el-table :data="tableData">
      <component v-for="(column, index) in columnData" :key="index" :is="getColumnComponent(column)" :prop="column.prop"
        :label="column.label" :width="column.width">
      </component>
    </el-table>
</template>
  
<script setup lang="ts">
import { ElInput, ElSelect, ElTableColumn } from 'element-plus';

const getColumnComponent: (column: any) => any = (column) => {
    if (column.type === 'input') {
        return ElInput
    } else if (column.type ==='select') {
        return ElSelect
    }
    return ElTableColumn
}

defineProps<{ tableData: Array<any>; columnData: Array<any> }>()

</script>


<style scoped>
</style>